/****************************************************
	文件：IResCache.cs
	作者：HuskyT
	邮箱：1005240602@qq.com
	日期：2021/1/2 16:47:12
	功能：资源缓存 接口
*****************************************************/

namespace HTFW.Res
{
    public interface IResCache
    {
        /// <summary>
        /// 缓存资源
        /// </summary>
        /// <param name="key"></param>
        /// <param name="resData"></param>
        void Add(string key,ResData resData);

        /// <summary>
        /// 尝试获取缓存的资源
        /// </summary>
        /// <param name="key"></param>
        /// <param name="res"></param>
        /// <returns></returns>
        bool TryGet(string key, out ResData res);

        /// <summary>
        /// 获取缓存的资源
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        ResData Get(string key);

        /// <summary>
        /// 获取缓存的资源
        /// </summary>
        /// <param name="crc"></param>
        /// <returns></returns>
        ResData Get(uint crc);

        /// <summary>
        /// 移除资源
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        bool Remove(string key);

        /// <summary>
        /// 移除资源
        /// </summary>
        /// <param name="crc"></param>
        /// <returns></returns>
        bool Remove(uint crc);

        /// <summary>
        /// 缓存中是否已经包含该资源
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        bool Contains(string key);
        
        /// <summary>
        /// 缓存中是否已经包含该资源
        /// </summary>
        /// <param name="resData"></param>
        /// <returns></returns>
        bool Contains(ResData resData);
    }
}